import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)


const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "pc" */ '../views/login.vue')
  },

  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/homePage',
        name: 'homePage',
        component: () => import(/* webpackChunkName: "pc" */ '../views/index.vue')
      },
      {
        path: '/addProduct',
        name: 'addProduct',
        component: () => import(/* webpackChunkName: "product" */ '../views/product/addProduct.vue')
      },
      {
        path: '/productList',
        name: 'productList',
        component: () => import(/* webpackChunkName: "product" */ '../views/product/productList.vue')
      },
      {
        path: '/classifyList',
        name: 'classifyList',
        component: () => import(/* webpackChunkName: "product" */ '../views/product/classifyList.vue')
      },
      {
        path: '/evaluateList',
        name: 'evaluateList',
        component: () => import(/* webpackChunkName: "product" */ '../views/product/evaluateList.vue')
      },
      {
        path: '/QAList',
        name: 'QAList',
        component: () => import(/* webpackChunkName: "product" */ '../views/product/QAList.vue')
      },
      {
        path: '/brandMerchants',
        name: 'brandMerchants',
        component: () => import(/* webpackChunkName: "product" */ '../views/product/brandMerchants.vue')
      },
      {
        path: '/supplier',
        name: 'supplier',
        component: () => import(/* webpackChunkName: "product" */ '../views/product/supplier.vue')
      },
      {
        path: '/orderList',
        name: 'orderList',
        component: () => import(/* webpackChunkName: "order" */ '../views/order/orderList.vue')
      },
      {
        path: '/videoList',
        name: 'videoList',
        component: () => import(/* webpackChunkName: "content" */ '../views/content/videoList.vue')
      },
      {
        path: '/articleList',
        name: 'articleList',
        component: () => import(/* webpackChunkName: "content" */ '../views/content/articleList.vue')
      },
      {
        path: '/bannerList',
        name: 'bannerList',
        component: () => import(/* webpackChunkName: "content" */ '../views/content/bannerList.vue')
      },
      {
        path: '/kindList',
        name: 'kindList',
        component: () => import(/* webpackChunkName: "content" */ '../views/content/kindList.vue')
      },
      {
        path: '/userList',
        name: 'userList',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/userList.vue')
      },
      {
        path: '/operatorList',
        name: 'operatorList',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/operatorList.vue')
      },
      {
        path: '/saleUserList',
        name: 'saleUserList',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/saleUserList.vue')
      },
      {
        path: '/wuLiuInformation',
        name: 'wuLiuInformation',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/wuLiuInformation.vue')
      },
      {
        path: '/vipLevel',
        name: 'vipLevel',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/vipLevel.vue')
      },
      {
        path: '/applyList',
        name: 'applyList',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/applyList.vue')
      },
      {
        path: '/companyList',
        name: 'companyList',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/companyList.vue')
      },
      {
        path: '/noticeList',
        name: 'noticeList',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/noticeList.vue')
      },
      {
        path: '/noticeList2',
        name: 'noticeList2',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/noticeList.vue')
      },
      {
        path: '/codeList',
        name: 'codeList',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/codeList.vue')
      },
      {
        path: '/settlementList',
        name: 'settlementList',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/settlementList.vue')
      },

      {//文章，视频评论
        path: '/comment',
        name: 'comment',
        component: () => import(/* webpackChunkName: "system" */ '../views/content/comment.vue')
      },
      {
        path: '/roleList',
        name: 'roleList',
        component: () => import(/* webpackChunkName: "system" */ '../views/system/roleList.vue')
      },





    ]
  }
]





const router = new VueRouter({
  routes,
})

router.beforeEach((to, from, next) => {

  // if (to.path === '/login') return next()
  // const companyId = window.sessionStorage.companyId
  // if (!companyId) return next('/login')
  return next()

})




export default router
